package com.zhanggm.springboot.demo.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhanggm.springboot.demo.mapper.UserMapper;
import com.zhanggm.springboot.demo.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     * 分页查询
     * @param user
     * @param pageNum
     * @param pageSize
     * @return
     */

    public PageInfo<User> getPageInfo(User user,Integer pageNum,Integer pageSize){
        PageHelper.startPage(pageNum,pageSize);
        List<User> userList = userMapper.select();
        return new PageInfo<>(userList);
    }
    @Transactional
    public void addOder(){
        //插入订单表
        //插入订单明细表
        handlerOrder();
    }
    @Transactional
    public void handlerOrder(){
        //添加物流信息
        //订单出库
    }

}
